package com.example.surveyapplication;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;

public class TestSettingActivity extends Activity implements OnClickListener{
	Button btnBegin;
	ImageView imvSetting;
	Spinner spnStress_TestSetting;
	Spinner spnDepression_TestSetting;
	Spinner spnAnxiety_TestSetting;
	ArrayAdapter<CharSequence> adapterSpinner;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test_setting);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		
		spnStress_TestSetting = (Spinner) findViewById(R.id.spnStress_TestSetting);
		adapterSpinner = ArrayAdapter.createFromResource(this,
		        R.array.spnStress_TestSetting_array, android.R.layout.simple_spinner_item);
		// Specify the layout to use when the list of choices appears
		adapterSpinner.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		// Apply the adapter to the spinner
		spnStress_TestSetting.setAdapter(adapterSpinner);
		imvSetting = (ImageView)findViewById(R.id.imvSetting_TestSetting);
		
		
		//
		spnDepression_TestSetting = (Spinner) findViewById(R.id.spnDepression_TestSetting);
		adapterSpinner = ArrayAdapter.createFromResource(this,
		        R.array.spnDepression_TestSetting_array, android.R.layout.simple_spinner_item);
		adapterSpinner.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		// Apply the adapter to the spinner
		spnDepression_TestSetting.setAdapter(adapterSpinner);
		
		//
		spnAnxiety_TestSetting = (Spinner) findViewById(R.id.spnAnxiety_TestSetting);
		adapterSpinner = ArrayAdapter.createFromResource(this,
		        R.array.spnAnxiety_TestSetting_array, android.R.layout.simple_spinner_item);
		adapterSpinner.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		// Apply the adapter to the spinner
		spnAnxiety_TestSetting.setAdapter(adapterSpinner);
		
		
		
		btnBegin = (Button)findViewById(R.id.btnBegin_TestSetting);		
		btnBegin.setOnClickListener(this);
		imvSetting.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.test_setting, menu);
		return true;
	}

	public void onClick(View view) {
		Intent intent;
		switch (view.getId())
		{
		case R.id.btnBegin_TestSetting:
			intent = new Intent(this, TestActivity.class);
			startActivity(intent);
			break;
		case R.id.imvSetting_TestSetting:
			intent = new Intent(this, SettingActivity.class);
			startActivity(intent);
		default:
			break;
		}
	}
}
